<h2>mach_port_destroy</h2>
<hr>
<p>
<strong>Function</strong> - Deallocate all port rights associated with specified name.
<h3>SYNOPSIS</h3>
<pre>
<strong>kern_return_t   mach_port_destroy</strong>
                <strong>(ipc_space_t</strong>                               <var>task</var>,
                 <strong>mach_port_name_t</strong>                          <var>name</var><strong>);</strong>
</pre>
<h3>PARAMETERS</h3>
<dl>
<p>
<dt> <var>task</var> 
<dd>
[in task send right]
The task holding the right.
<p>
<dt> <var>name</var> 
<dd>
[in scalar]
The task's name for the right.
</dl>
<h3>DESCRIPTION</h3>
<p>
The <strong>mach_port_destroy</strong> function de-allocates all rights
denoted by a name. 
The name becomes immediately available for reuse. 
<p>
For most purposes, 
<strong>mach_port_mod_refs</strong> and <strong>mach_port_deallocate</strong> are
preferable.
<p>
If <var>name</var> denotes a port set, then all members of the port set are implicitly
removed from the port set.
<p>
If <var>name</var> denotes a receive right that is a member of a port set,
the receive right is 
implicitly removed from the port set.  Remaining messages queued to the port 
are destroyed and extant send and send-once rights turn into dead names.  If 
those send and send-once rights have dead-name requests registered, then
dead-name notifications are generated for them. 
<p>
If <var>name</var> denotes a send-once right, then 
the destruction of the send-once right 
produces a send-once notification for the port. 
<p>
If <var>name</var> denotes a send-once, send, and/or receive right, and
it has a dead-name 
request registered, then a port-deleted notification is generated
(as opposed to a 
dead-name notification).
<h3>NOTES</h3>
<p>
This interface is machine word length specific because of the port name
parameter.
<h3>RETURN VALUES</h3>
<dl>
<p>
<dt> <strong>KERN_INVALID_NAME</strong>
<dd>
The <var>name</var> parameter did not denote a right.
</dl>
<h3>RELATED INFORMATION</h3>
<p>
Functions:
<a href="mach_port_allocate.html"><strong>mach_port_allocate</strong></a>,
<a href="mach_port_allocate_name.html"><strong>mach_port_allocate_name</strong></a>,
<a href="mach_port_mod_refs.html"><strong>mach_port_mod_refs</strong></a>,
<a href="mach_port_deallocate.html"><strong>mach_port_deallocate</strong></a>,
<a href="MP_request_notification.html"><strong>mach_port_request_notification</strong></a>.
